# -*- coding:utf-8
import configparser
import os
import requests
import getopt
import sys
import pytest


def get_conf():
    for _ in sys.argv[:]:
        # logger.info(l)
        arg = _.split("=")
        if len(arg) == 2:
            opt = arg[0]
            value = arg[1]
            if opt == "--conf":
                return value
    return "config.ini"

def read_ini_config(key1: str, key2: str, *args: str):
    pro_dir = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
    # logger.info("-----------------")
    # logger.info(get_conf())
    config_path = os.path.join(pro_dir, "config.ini")
    config = configparser.ConfigParser()
    config.read_file(open(config_path))
    value = config.get(key1, key2)
    if 'int' in args:
        return int(value)
    elif 'float' in args:
        return float(value)
    else:
        return value


if __name__ == '__main__':
    pass
